< previous page page_975 next page >

Page 975
3. The default size of a Microsoft Jet TEXT field is 255 bytes.
4. You use the ALTER TABLE_ADD COLUMN statement to add a column to a table. The ALTER TABLE_ADD COLUMN statement uses the following format:
ALTER TABLE <Name of Table> ADD COLUMN <Name of column> <Type> <Size>;
5. You use the DROP TABLE statement to remove a table from a database. The DROP TABLE statement uses the following format:
DROP TABLE <Table Name>;
6. You create indexes to data tables with the CREATE INDEX SQL statement.
7. The following are the three forms of the CONSTRAINT clause:
e7ae6bd512ad4c3583017fcda52f57ae.gif
·PRIMARY KEY
e7ae6bd512ad4c3583017fcda52f57ae.gif
·UNIQUE
e7ae6bd512ad4c3583017fcda52f57ae.gif
·FOREIGN KEY
Answer to Day 13 Exercise
Enter the following code to build the CustomerType and Customers tables. Please note that the CustomerType table must be built before the Customers table, because of the foreign key constraint on CustomerType in the Customers table.
// Create the database
dbmake C:\CUSTOMER\CH13EX.MDB;
// Build the Customer Types Table
CREATE TABLE CustomerType(
     CustomerType TEXT(6) CONSTRAINT PKCustomerType PRIMARY KEY,
     Description TEXT(30));
// Build the Customers table
CREATE TABLE Customers(
     CustomerID TEXT(10) Constraint PKCustomerID PRIMARY KEY,
     Name TEXT(30),
     CustomerType TEXT(6) CONSTRAINT FKCustomerType
      _REFERENCES CustomerType(CustomerType),
     Address TEXT(30),
     City TEXT(30),
     State TEXT(30),
     Zip TEXT(10),
     Phone TEXT(14),
     Fax TEXT(14));
// Build the index on Zip
CREATE INDEX SKZip on Customers(Zip);
//Display the results
SELECT * FROM CustomerType;
SELECT * FROM Customers;

 
< previous page page_975 next page >

If you like this book, buy it!